const htmlparser2 = require('htmlparser2');
const fs = require('fs');
const path = require('path');

let f = fs.readFileSync(path.resolve(__dirname,'tmps/test.tpl'));
let tree = htmlparser2.parseDOM(f.toString());
console.log('编译出来的 json 文件：');
console.log(tree);

fs.writeFileSync('json/tree.json', JSON.stringify(tree));